#ifndef TOOL_H
#define TOOL_H
#include "Action.h"
#include "../glist/gList.h"
#define showError(message) printf("%s\n",message)
class JAMTool: public Action
{

public:
    JAMTool():Action("-h"){
        this->comands[0] = new Compress();
        this->comands[1] = new DeCompress();
        this->comands[2] = this;
       /** this->jamComands = new GList<Action>;
        Action* c = new Compress();
        this->jamComands->add(*c);
        this->jamComands->get(0).showInformation();**/
    }


    void executeComand(int arg, char** args){
        bool finded = false;
            while(*args&&!finded){
                char* comand = *args;
                int tam = 3,i = 0;
                 finded = false;
                while(i<tam&&!finded){
                    finded = this->comands[i]->compareIdentifier(comand);
                    if(finded){
                        this->comands[i]->execute(arg,++args);
                    }
                    i++;
                }
                args++;
            }
            if(!finded){
                showError("Invalid parameters try with -h for look information");
            }
    }
     void execute(int arg, char** args)
    {
        showInformation();
    }

     void showFailed() {

    }

     void showInformation(){
         for(int i = 0; i<2; i++){
             this->comands[i]->showInformation();
         }
     }
private :
     Action *comands[4];
};

#endif // TOOL_H
